<?php

namespace app\admin\command;

use think\console\Command;
use think\console\Input;
use think\console\Output;
use app\admin\tests\ClassSequenceTest;

/**
 * 测试班级序号功能的命令
 */
class TestClassSequence extends Command
{
    protected function configure()
    {
        $this->setName('class_sequence:test')
            ->setDescription('Run tests for class sequence functionality');
    }

    protected function execute(Input $input, Output $output)
    {
        $output->writeln("开始运行班级序号功能测试...");
        
        try {
            $tester = new ClassSequenceTest();
            $result = $tester->run();
            
            if ($result) {
                $output->writeln("<info>所有测试通过！</info>");
                return 0;
            } else {
                $output->writeln("<error>测试失败！</error>");
                return 1;
            }
        } catch (\Exception $e) {
            $output->writeln("<error>测试过程中发生错误: " . $e->getMessage() . "</error>");
            return 1;
        }
    }
}